package com.example.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.domain.Stu;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class StuServiceTestCase {

    @Autowired
    private StuService stuService;

    @Test
    void testGetById(){
        System.out.println(stuService.getById(1));
    }

    @Test
    void testSave(){
        Stu stu = new Stu();
        stu.setName("网五月ssssss");
        stu.setPassword("35315");
        stu.setGender('男');
        stuService.save(stu);
    }

    @Test
    void testUpdate(){
        Stu stu = new Stu();
        stu.setId(12);
        stu.setName("网五月---ss");
        stu.setPassword("35315");
        stu.setGender('男');
        stuService.update(stu);
    }

    @Test
    void testDelete(){
        stuService.delete(12);
    }

    @Test
    void testGetAll(){
        stuService.getAll();
    }

    @Test
    void testGetPage(){
        IPage<Stu> page = stuService.getPage(2, 3);
        System.out.println(page.getCurrent());
        System.out.println(page.getSize());
        System.out.println(page.getTotal());
        System.out.println(page.getPages());
        System.out.println(page.getRecords());
    }
}
